package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.BillPlan;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BillPlanDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "账单id")
    private Integer billId;

    @ApiModelProperty(value = "计划收款id")
    private Integer planId;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


    public BillPlanDTO() {}

    public BillPlanDTO(BillPlan entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static BillPlanDTO convert(BillPlan entity) {
        return new BillPlanDTO(entity);
    }

    public static List<BillPlanDTO> convertList(List<BillPlan> list) {
        List<BillPlanDTO> resultList = new ArrayList<>();
        for (BillPlan entity : list) {
            resultList.add(new BillPlanDTO(entity));
        }
        return resultList;
    }}
